home *** CD-ROM | disk | FTP | other *** search
- Path: aspentec.com!usenet
- From: Seb Rose <seb@hoboco.scotborders.co.uk>
- Newsgroups: comp.lang.c++,comp.os.ms-windows.nt.misc,comp.os.ms-windows.programmer.tools.mfc,comp.os.ms-windows.programmer.win32
- Subject: Re: MFC Extension DLL creation - different in VC++4?
- Date: Mon, 29 Jan 1996 09:49:17 +0000
- Organization: Aspen Technology, Inc.
- Message-ID: <310C981D.B75@hoboco.scotborders.co.uk>
- References: <822894063.29249@centa.demon.co.uk>
- NNTP-Posting-Host: bat.atuk.aspentec.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b3 (WinNT; I)
- CC: rose
-
- I think the documentation for AfxGetInstanceHandle is wrong when
- using MFC dynamically.
-
- My solution is this:
-
- class SwitchInstance
- {
- HINSTANCE m_hAppInst;
-
- public:
- SwitchInstance()
- {
- m_hAppInst = AfxGetResourceHandle();
-
- AfxSetResourceHandle(theDll.m_hInstance);
- }
-
- ~SwitchInstance()
- {
- AfxSetResourceHandle(m_hAppInst);
- }
- };
-
-
-
- In each exported function I create an instance of
- SwitchInstance.
-
- Everything works - magic!
-